<?php

namespace app\index\validate;
use think\Validate;
use think\Db;
class Login extends Validate
{
    // 验证规则
    protected $rule =   [
        'province_id'  => 'require|number',
        'city_id' =>'require|number',
        'hospital_id' =>'require|number|gt:0',
        'subject_id' =>'require|number',
        'count' =>'require|number|gt:0',
        'user_name'  => 'require',
        'doc_hospital'=>'require',
        'mobile'=>'require|number|length:11|gt:0',
        'name'=>'require',
        'email'=>'require',
    ];
    // 错误提示消息
    protected $message  =   [
        'province_id.require'  => '请选择省',
        'province_id.number' => '请选择省',
        'city_id.require'  => '请选择城市',
        'city_id.number' => '请选择城市',
        'hospital_id.require'  => '请选择医院',
        'hospital_id.number' => '请选择医院',
        'hospital_id.gt' =>  '请选择医院',
        'subject_id.require'  => '请选择科室',
        'subject_id.number' => '请选择科室',
        'count.require'  => '请填写参会人数',
        'count.number'  => '参会人数只能是数字',
        'count.gt' =>  '参会人数至少为1人',
        'user_name'=>'请填写姓名',
        'doc_hospital'=>'请填写医院',
        'mobile.require' =>  '手机号不能为空',
        'mobile.number' =>  '手机号必须为数字',
        'mobile.gt' =>  '手机号必须为数字',
        'mobile.length' => '手机号必须为11位',
        'name.require'=>'参数错误',
        'email.require'=>'参数错误',
    ];
    //场景
    protected $scene = [
        'user'  =>  ['province_id','city_id','hospital_id','subject_id','count','name','email'],
        'doctor'=>['user_name','doc_hospital','mobile'],
        'check'=>['name','email']
    ];
}